package com.yanqu.road.server.cmd.union.cross;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.union.Parergon;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.union.CrossUnionParergonMgr;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = Protocol.C_UNION_PARERGON_BARGAIN, desc = "砍价")
public class CrossBragainCmd extends CrossCommand {


    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

        Parergon.BargainReqMsg reqMsg = Parergon.BargainReqMsg.parseFrom(packet.getBytes());
        int bussinessId = reqMsg.getBussinessId();

        MessageHelper.sendPacket(serverId, packet.getPlayerId(), YanQuMessageUtils.buildMessage(Protocol.S_UNION_PARERGON_BARGAIN_FROM_CROSS, CrossUnionParergonMgr.bargain(bussinessId, packet.getPlayerId())));

    }

    @Override
    public void sendData() {

    }
}
